package bishi;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.Vector;

/**
 * @Author liuhaoqi
 * @Date 2020/8/28 19:01
 * @Version 1.0
 */
public class Jingdong02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Vector<Integer> vector = new Vector<>();
        while (n > 0) {
            int flag = scanner.nextInt();
            int type1th=0;
            int type1num=0;
            int type2th=0;
            if (flag == 1) {
                type1th = scanner.nextInt();
                type1num = scanner.nextInt();
                vector.insertElementAt(type1num,type1th-1);
            } else if (flag == 2) {
                type2th = scanner.nextInt();
                vector.remove(type2th-1);
            } else {
                for (int i = 0; i < vector.size(); i++) {
                    System.out.print(vector.get(i)+" ");
                }
            }
            n--;
        }
    }
}
